/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package datos;

import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeSet;
import logica.ComparaIDSnacks;

/**
 *
 * @author Cristian
 */
public class ListaSnacks
{


 private SortedSet <Snack> miSet;
 private Comparator comparadorIDSnack;


      public ListaSnacks()
    {
          comparadorIDSnack = new ComparaIDSnacks();
          miSet = new TreeSet(comparadorIDSnack);
    }


     public void imprimirColeccion()
    {
        int i;
        Snack registro;
        Object [] arreglo;
        arreglo = miSet.toArray();
        System.out.println("Snack: "+arreglo.length);

        for(i=0 ; i<arreglo.length ; i++)
        {
            registro = (Snack) arreglo[i];
            System.out.println("Snack " +(i+1)+": "+registro.getNobre());
        }
        System.out.println("\n\n");
    }

   public boolean agregarGusto(Snack objeto)
    {
        return miSet.add(objeto);
    }

    public boolean removerGusto(Snack objeto)
    {
        return (miSet.remove(objeto));
    }


}
